package com.soriya.switcher.component

import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.RectangleShape
import androidx.compose.ui.graphics.Shape
import androidx.compose.ui.res.dimensionResource
import com.soriya.switcher.ui.theme.Primary
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch

@Composable
fun VerySmallerTextButton(
    text: String,
    onClick: () -> Unit,
    modifier: Modifier = Modifier,
    border: BorderStroke? = null,
    shape: Shape = RectangleShape,
    backgroundColor: Color = Color(0xFF11111C),
    paddingValues: PaddingValues = PaddingValues(
        dimensionResource(com.soriya.common.R.dimen.xdp_16),
        dimensionResource(com.soriya.common.R.dimen.xdp_12)
    )
) {
    VerySmallerText(
        text = text,
        modifier = modifier
            .clickable(onClick = onClick)
            .then(
                if (border != null) {
                    Modifier.border(border, shape)
                } else {
                    Modifier
                }
            )
            .background(color = backgroundColor, shape = shape)
            .padding(paddingValues)
    )
}